#!/bin/bash

# 获取所有NPU ID
npu_ids=$(npu-smi info -l | grep "NPU ID" | awk '{print $4}')

# 打印表头
printf "%-10s %-20s %-20s %-20s\n" "NPU ID" "软件版本" "固件版本" "MCU 版本"
echo "-------------------------------------------------------------"

# 检查每个NPU的驱动版本、固件版本和MCU版本
for id in $npu_ids; do
    npu_info=$(npu-smi info -t board -i $id)
    software_version=$(echo "$npu_info" | grep "Software Version" | awk '{print $4}')
    firmware_version=$(echo "$npu_info" | grep "Firmware Version" | awk '{print $4}')
    
    # 获取MCU版本
    mcu_version=$(npu-smi upgrade -b mcu -i $id | grep "Version" | awk '{print $3}')
    
    # 打印每一行数据
    printf "%-10s %-16s %-17s %-20s\n" "$id" "$software_version" "$firmware_version" "$mcu_version"
done